package com.jy.modules.cims.component.balance;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class MathFormulaUtils {
	
	/**
	 * 等额本息月还计算
	 * @Description 
	 * @param monthlyRate 月还利率
	 * @param contractAmt 
	 * @param term
	 * @return   
	 * BigDecimal  
	 * @throws
	 * @author zhangmi
	 * @date 2016-7-8
	 */
	public static BigDecimal Math_MonthRepay_RT01(BigDecimal monthlyRate,BigDecimal contractAmt,int term){
		double ratePram =  Math.pow(1+monthlyRate.doubleValue(), term);
		//月还金额
		BigDecimal thisRepaySum =contractAmt.multiply(monthlyRate).multiply(new BigDecimal(ratePram)).divide(new BigDecimal(ratePram-1),12,RoundingMode.HALF_UP);
		thisRepaySum = thisRepaySum.setScale(2,   BigDecimal.ROUND_HALF_UP);
		
		return thisRepaySum;
	}
}
